package pr;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Scanner;

public class PreProcessing {

	public static void main(String[] args) {
		String binaryImageData = "resource/BinaryImageData.txt";
		int binaryArray[][] = PreProcessing.readFile(binaryImageData, 16, 19);
		
		int [][] binaryMask = {{1, 1, 1}, {1, 1, 1},{1, 1, 1}};
//		Check neighbors
//		
		
		String grayscaleImageData = "resource/GrayscaleImageData.txt";
		int greyArray[][] = PreProcessing.readFile(grayscaleImageData, 18, 20);
		
		int [][] greyMask = {{1, 1, 1}, {1, 1, 1},{1, 1, 1}};

	}

	public static void smoothImage(int img[][][], int mask[][]) {

	}

	public static int[][] readFile(String fileName, int row, int col) {
		int[][] a = new int[row][col];
		try {
			Scanner input = new Scanner(new File(fileName));
			for (int i = 0; i < row; i++) {
				for (int j = 0; j < col; j++) {
					if (input.hasNextInt()) {
						a[i][j] = input.nextInt();
					}
				}
			}
			input.close();
		} catch (FileNotFoundException fnf) {
			fnf.printStackTrace();
		}

		for (int i = 0; i < row; i++) {
			for (int j = 0; j < col; j++)
				System.out.print(a[i][j]);
			System.out.println();
		}

		return a;
	}

}
